package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 提现状态（1-待审核，2-审核失败，3-审核成功，4-提现中，5-提现成功，6-提现失败，7-待商户确认，8-商户已确认，待平台打款）
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum WithdrawalStateEnum {

    WAIT_AUDIT(1, "待审核"),
    AUDIT_FAIL(2, "审核失败"),
    AUDIT_SUCCESS(3, "审核成功"),
    WITHDRAWAL_PROGRESS(4, "提现中"),
    WITHDRAWAL_SUCCESS(5, "提现成功"),
    WITHDRAWAL_FAIL(6, "提现失败"),
    WAIT_MERCHANT_CONFIRM(7, "待商户确认"),
    MERCHANT_CONFIRMED(8, "商户已确认，待平台打款"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    WithdrawalStateEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static WithdrawalStateEnum typeOf(Integer value) {
        WithdrawalStateEnum[] values = WithdrawalStateEnum.values();
        for (WithdrawalStateEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static WithdrawalStateEnum typeOf(String name) {
        WithdrawalStateEnum[] values = WithdrawalStateEnum.values();
        for (WithdrawalStateEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
